from hdiary.injections.models import *
from hdiary.ampoules.models import *
from django.contrib.auth.models import User
import datetime

u1 = User.objects.create_user(username='admin',email='admin@gogaart.pl',password='admin')
u1.is_staff = True
u1.is_superuser = True
u1.save()

u2 = User.objects.create_user(username='johnny',email='jlennon@beatles.com',password='glass')
u2.is_staff = True
u2.save()



asAA = AmpouleSeries(code="AA", units="500")
asAA.save()
asBB = AmpouleSeries(code="BB", units="1000")
asBB.save()
asCC = AmpouleSeries(code="CC", units="1500")
asCC.save()
AmpouleSeries.objects.all()

p1 = Prevention(description="ostry trening: basen")
p1.save()
p2 = Prevention(description="ostry trening: rower")
p2.save()



ia1 = InjuryArea(injury_area="prawe kolano")
ia2 = InjuryArea(injury_area="lewe kolano")
ia3 = InjuryArea(injury_area="prawe przedramie")
ia1.save()
ia2.save()
ia3.save()

it1 = InjuryType(injury_type="wylew domiesniowy")
it2 = InjuryType(injury_type="wylew dostawowy")
it1.save()
it2.save()



in1 = Injury(type=it1,area=ia3)
in1.save()

in2 = Injury(type=it2,area=ia1)
in2.save()




r1 = Reception(rec_date=datetime.datetime.now(),comment="ok")

r1as1 = AmpouleSeriesReception(reception=r1,ampoule_series=asAA,amount=10)
r1as2 = AmpouleSeriesReception(reception=r1,ampoule_series=asBB,amount=10)

r1.save()
r1as1.save()
r1as2.save()


i1 = Injection(inj_date=datetime.datetime.now(),comment="profilaktyka")
i1as1 = AmpouleSeriesInjection(injection=i1,ampoule_series=asAA,amount=1)
i1as2 = AmpouleSeriesInjection(injection=i1,ampoule_series=asBB,amount=1)

i1.save()
i1as1.save()
i1as2.save()





i1pa1 = InjectionPreventionAssociation(injection=i1,prevention=p1)
i1pa1.save()

i1ia1 = InjectionPreventionAssociation(injection=i1,prevention=p1)
i1ia1.save()


i1ia1 = InjectionInjuryAssociation(injection=i1,injury=in1)

i1ia1.save()











as3 = AmpouleSeries.objects.get(code="CC")